﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace GKS.Extensions {
    public class TypeExtensions {
        #region variables

        #endregion

        #region properties

        #endregion

        #region enums

        #endregion

        #region constructors

        #endregion

        #region methods
        /// <summary>
        /// A method that checks if a Type is a (standard) numeric type or not.
        /// </summary>
        /// <param name="obj">
        /// The type to check.
        /// </param>
        /// <returns>
        /// TRUE if the specified Type is a (standard) numeric type, FALSE otherwise.
        /// </returns>
        /// <remarks>
        /// The standard numeric types taken into consideration are:
        ///     - byte
        ///     - sbyte
        ///     - decimal
        ///     - double
        ///     - float
        ///     - int
        ///     - uint
        ///     - long
        ///     - ulong
        ///     - short
        ///     - ushort
        ///     - Complex
        ///     - BigInteger.
        /// </remarks>
        public bool IsNumeric(this Type type) {
            return type == typeof(byte)
                || type == typeof(decimal)
                || type == typeof(double)
                || type == typeof(float)
                || type == typeof(int)
                || type == typeof(long)
                || type == typeof(sbyte)
                || type == typeof(short)
                || type == typeof(uint)
                || type == typeof(ulong)
                || type == typeof(ushort)
                || type == typeof(Complex)
                || type == typeof(BigInteger);
        }
        #endregion
    }
}
